Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(auth): set up App Store modules #12374

Merged
merged 1 commit into from
Apr 22, 2022

Conversation

biancadanforth
Copy link
Contributor

@biancadanforth biancadanforth commented Apr 3, 2022

Because:

  • We want SubPlat to know about Apple IAP subscriptions for our RPs.

This commit:

  • Sets up the needed Apple IAP modules in lib/payments/iap/apple-app-store including classes, their methods and types, largely modeled after the Google Play IAP modules.
  • Adds App Store config (under config.subscriptions.appStore) including a sandbox flag and App Store credentials by app bundleId.
  • Moves lib/payments/google-play to lib/payments/iap/google-play.
  • Moves IAPConfig class to the new shared lib/payments/iap dir.
  • Adds two new libraries to the auth server: app-store-server-api (App Store Server API client) and type-fest (for helpful TS types, such as RequireAtLeastOne used here).

Closes #10313, closes #12579

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

Screenshots (Optional)

Please attach the screenshots of the changes made in case of change in user interface.

Other information (Optional)

Here are the analogs I modeled the different modules on from the Google Play Store integration:

  • AppleIAP ←→ PlayBilling
  • SubscriptionPurchase ←→ SubscriptionPurchase
  • PurchaseManager ←→ PurchaseManager/UserManager

@biancadanforth
Copy link
Contributor Author

@bbangert I'm particularly interested in feedback on any parts that I can descope (e.g. if they are or can be covered by separate tickets) in order to land this sooner rather than later and unblock the other tickets.

@biancadanforth biancadanforth force-pushed the fxa-3934-apple-iap-base-class branch 4 times, most recently from 2b25ada to f0449be Compare April 13, 2022 13:36
Copy link
Contributor Author

@biancadanforth biancadanforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bbangert : Here is the finished patch without tests and some questions for you. It'd be great if you can review this while I am working on fixing/adding tests. I'll ping you in Slack about this as well as we discussed.

Thank you in advance; I know this is a very large patch.

@biancadanforth biancadanforth force-pushed the fxa-3934-apple-iap-base-class branch 4 times, most recently from 7bca437 to e0a25f0 Compare April 14, 2022 16:23
Copy link
Contributor Author

@biancadanforth biancadanforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost done with tests. I fixed (or attempted to in a couple of cases; see inline comments) the issues we discussed earlier today.

@biancadanforth biancadanforth force-pushed the fxa-3934-apple-iap-base-class branch 4 times, most recently from 1c5c1e3 to 713b82e Compare April 16, 2022 01:54
@biancadanforth biancadanforth marked this pull request as ready for review April 16, 2022 01:55
@biancadanforth biancadanforth requested a review from a team as a code owner April 16, 2022 01:55
@biancadanforth
Copy link
Contributor Author

biancadanforth commented Apr 16, 2022

I think we disabled squash and merge, but I can do an interactive rebase and roll these commits into one commit before merging.

I will file a follow-up ticket to set the App Store credentials/sandbox env vars in stage and prod and open a cloudops PR.

Edit: CloudOps ticket is https://mozilla-hub.atlassian.net/browse/FXA-4941 (#12594 ).

Copy link
Member

@bbangert bbangert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Minor nit about the error, I'd imagine we'd figure it out quick if we did hit it since Apple purchase registration wouldn't work.

Because:

* We want SubPlat to know about Apple IAP subscriptions for our RPs.

This commit:

* Sets up the needed Apple IAP modules in lib/payments/iap/apple-app-store including classes, their methods and types, largely modeled after the Google Play IAP modules.
* Adds App Store config (under config.subscriptions.appStore) including a sandbox flag and App Store credentials by app bundleId.
* Moves lib/payments/google-play to lib/payments/iap/google-play.
* Moves IAPConfig class to the new shared lib/payments/iap dir.
* Adds two new libraries to the auth server: app-store-server-api (App Store Server API client) and type-fest (for helpful TS types, such as RequireAtLeastOne used here).

Closes #10313, closes #12579
@biancadanforth biancadanforth changed the title feat(auth): initial Apple IAP modules feat(auth): set up App Store modules Apr 22, 2022
@biancadanforth biancadanforth merged commit b69e215 into main Apr 22, 2022
@biancadanforth biancadanforth deleted the fxa-3934-apple-iap-base-class branch April 22, 2022 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[subplat][AppleIAP] Update exports in apple-app-store/api-client Create App Store payment class
2 participants